import {RECORD_ADDRESS,SAVE_GEOHASH,RECORD_USERINFO,SAVE_ADDDETAIL,ADD_ADDRESS,SAVE_ADDRESS,RECORD_SHOPDETAIL
,INIT_BUYCART,SAVE_CART_ID_SIG} from './constant'
export default {
    //保存geohash
	[SAVE_GEOHASH](state, geohash){
		state.geohash = geohash;
	},
    [RECORD_ADDRESS](state,{latitude,longitude}){
        state.latitude=latitude;
        state.longitude=longitude;
    },
    ['RECORD_SHOPID'](state,id){
      state.shopId=id;
    },
    [RECORD_USERINFO](state,userinfo){
        state.user=userinfo
    },
    //添加地址name
	[SAVE_ADDDETAIL](state, addAddress){
		state.addAddress=addAddress;
    },
    [ADD_ADDRESS](state, obj) {
		state.removeAddress = [obj, ...state.removeAddress];
    },
    //删除地址列表
	[SAVE_ADDRESS](state, newAdress) {
		state.removeAddress = newAdress
    },
    [RECORD_SHOPDETAIL](state, detail) {
		state.shopDetail = detail;
    },
    [INIT_BUYCART](state, list) {
		state.cartList = list;
    },
    //保存下单后购物id 和 sig
	[SAVE_CART_ID_SIG](state, {
		cart_id,
		sig
	}) {
		state.cart_id = cart_id;
		state.sig = sig;
  },
  ['CHOOSE_ADDR'](state,v){
    state.choosedAddress=v.address;
    state.addressIndex=v.index;
  },
  ['CONFIRM_REMARK'](state, {
		remarkText,
		inputText
	}) {
		state.remarkText = remarkText;
		state.inputText = inputText;
  },
  ['CHOOSE_SEARCH_ADDR'](state,v){
    state.searchAddress=v;
  },
  //确认订单页添加新的的地址
	['CONFIRM_ADDRESS'](state, newAddress) {
		state.newAddress.push(newAddress);
  },
  ['REMARKS'](state,v){
    state.remarks=v;
  },
  ['ORDER'](state,v){
    state.order=v;
  },
  ['QUESTION'](state,v){
    state.question=v;
  },
  
}